package gframework.bean.passwordField;

import gframework.bean.textField.MascaraPropertyEditor;
import java.beans.*;

public class GPasswordFieldBeanInfo extends SimpleBeanInfo {
    private final static Class beanClass = GPasswordField.class;
    private static BeanDescriptor beanDescriptor = null;
    private static java.awt.Image icon = null;

    @Override
    public BeanDescriptor getBeanDescriptor() {
        beanDescriptor = new BeanDescriptor(beanClass);
        beanDescriptor.setDisplayName("VR PasswordField");
        
        return beanDescriptor;
    }

    @Override
    public PropertyDescriptor[] getPropertyDescriptors() {
        try {
            PropertyDescriptor mascaraPD = new PropertyDescriptor("mascara", beanClass);
            PropertyDescriptor columnsPD = new PropertyDescriptor("columns", beanClass);
            PropertyDescriptor caixaAltaPD = new PropertyDescriptor("caixaAlta", beanClass);

            PropertyDescriptor rv[] = {caixaAltaPD, mascaraPD, columnsPD};
            
            mascaraPD.setPropertyEditorClass(MascaraPropertyEditor.class);
            
            return rv;

        } catch (IntrospectionException e) {
            throw new Error(e.toString());
        }
    }

    @Override
    public BeanInfo[] getAdditionalBeanInfo() {
        Class superclass = GPasswordField.class.getSuperclass();
        
        try {
            BeanInfo superBeanInfo = Introspector.getBeanInfo(superclass);
            
            return new BeanInfo[]{superBeanInfo};
            
        } catch (IntrospectionException ex) {
            ex.printStackTrace();
            
            return null;
        } 
    }
    
    @Override
    public java.awt.Image getIcon(int iconKind) {
        if (iconKind == ICON_COLOR_16x16 || iconKind == ICON_MONO_16x16) {
            icon = loadImage("passwordField16.png");
        } else if (iconKind == ICON_COLOR_32x32 || iconKind == ICON_MONO_32x32) {
            icon = loadImage("passwordField32.png");
        } else {
            icon = null;
        }

        return icon;
    }
}
